<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }

        #demo {
            height: 500px;
            width: 500px;
            border: 2px solid;
            background: blanchedalmond;
        }
    </style>
</head>

<body>
    <div id="demo"></div>
    <script>
        document.querySelector('#id').addEventListener('click', () => {
            console.log('我点击了');
        })
    </script>
</body>

</html>